﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ShineTech.Domain.SeedWork
{
    public class PageData<T>
    {
        public PageData()
        {
        }

        public PageData(int pageIndex, int pageSize, int totalCount, IEnumerable<T> data)
        {
            PageSize = pageSize;
            PageIndex = pageIndex;
            TotalCount = totalCount;
            Data = data;
        }

        public int PageSize { get; private set; }
        public int PageIndex { get; private set; }

        public int TotalCount { get; set; }

        public IEnumerable<T> Data { get; set; }


    }

    /// <summary>
    /// 分页扩展方法
    /// </summary>
    public static class PageDataExtensions
    {


        public static PageData<T> ToPageDataList<T>(this IEnumerable<T> list, int pageIndex, int pageSize, int totalCount)
        {
            var dataList = new PageData<T>(pageIndex, pageSize, totalCount, list);
            return dataList;
        }


    }
}
